package com.gy.api.mobile.app;


import com.gy.api.base.ApiIndex;
import com.gy.api.base.IDEntity;
import com.gy.api.base.R;
import com.gy.api.pc.filings.domain.vo.WcPatentApplicationRecommendationVO;
import com.gy.api.pc.filings.domain.vo.WcPatentApplicationSaveVO;
import com.gy.api.pc.filings.domain.vo.WcPatentApplicationUpdateVO;
import com.gy.api.pc.filings.domain.vo.WcPatentApplicationVO;
import com.gy.api.pc.filings.service.IPatentApplicationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/app/system/wcPatentApplication")
@Api( tags = ApiIndex.WcPatentApplicationController)
@Slf4j
public class WcPatentApplicationController {

    @Autowired
    IPatentApplicationService service;

    @ApiOperation("(app)新增剧本备案申请")
    @PostMapping("/add")
    @ResponseBody
    public R addSave(@RequestBody WcPatentApplicationSaveVO saveVO){
        service.addSave(saveVO);
        return new R();
    }

    @ApiOperation("(app)修改剧本备案申请")
    @PostMapping("/edit")
    @ResponseBody
    public R editSave(@RequestBody WcPatentApplicationUpdateVO saveVO){
        service.editSave(saveVO);
        return new R();
    }

    @ApiOperation("剧本备案申请详情")
    @GetMapping("/getById/{id}")
    @ResponseBody
    public R<WcPatentApplicationVO> getById(@PathVariable("id") String id) {
        WcPatentApplicationVO vo = service.getById(id);
        return new R(vo);
    }

    @ApiOperation("删除剧本备案申请")
    @PostMapping("/remove")
    @ResponseBody
    public R remove(@RequestBody IDEntity id) {
         service.removeById(id.getId());
        return new R();
    }


    @ApiOperation("【新】查询反馈国家电影局信息")
    @GetMapping("/get_recommendation")
    public R<List<WcPatentApplicationRecommendationVO>> getList(@ApiParam(value = "查询参数") @ModelAttribute IDEntity saveVO) throws Exception {
        return new R(service.getRecommendationList(saveVO));
    }
}
